package com.ben.multiple.mycat.two;

import org.junit.jupiter.api.BeforeAll;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

/**
 * @author BenJin Yin
 * @date 2020/7/16
 */
@SpringBootTest
class Base {
    static final String GLOBAL_URL_PREFIX = "http://localhost:9092";

    static TestRestTemplate restTemplate;

    @BeforeAll
    static void init() {
        restTemplate = new TestRestTemplate(new RestTemplateBuilder());
    }

    protected void print(ResponseEntity<Object> entity) {
        if (entity == null || HttpStatus.OK != entity.getStatusCode()) {
            System.out.println(entity);
            return;
        }
        System.out.println(entity.getBody());
    }
}
